﻿using System;
using System.Windows.Forms;
using Microsoft.SqlServer.Dts.Pipeline.Design;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime;

namespace SSIS.MS.xRM.Destination
{
    public class XRMDestinationUI : IDtsComponentUI
    {
        IDTSComponentMetaData100 _dtsComponentMetaData100;
        IServiceProvider _serviceProvider;

        public void Help(IWin32Window parentWindow)
        {
        }
        public void New(IWin32Window parentWindow)
        {
        }
        public void Delete(IWin32Window parentWindow)
        {
        }
        public bool Edit(IWin32Window parentWindow, Variables variables, Connections connections)
        {
            DialogResult result;
            using (var componentEditor = new frmXRMDestinationUI(connections, variables, _dtsComponentMetaData100))
            {
                result = componentEditor.ShowDialog(parentWindow);
            }

            return result == DialogResult.OK;
        }
        public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
        {
            _dtsComponentMetaData100 = dtsComponentMetadata;
        }
    }
}
